#pragma once

#include "Misc/CommonMacros.h"
#include "Reflection/Reflection.h"
#include "Keys.m.h"

RENUM()
enum class EKey 
{
    UnSupportedKey =0, // the key maybe exist , but i can't test it(i donot have a keyboard with them)

    Escape,

    Left,
    Right, 
    Down,
    Up,

    Backspace,
    Enter,
    
    A,
    B,
    C,
    D,
    E,
    F,  
    G,
    H,
    I,
    J,
    K,
    L,
    M,
    N,
    O,
    P,
    Q,
    R,
    S,
    T,
    U,
    V,
    W,
    X,
    Y,
    Z,


    Key0,
    Key1,
    Key2,
    Key3,
    Key4,
    Key5,
    Key6,
    Key7,
    Key8,
    Key9,

    F1,
    F2,
    F3,
    F4,
    F5,
    F6,
    F7,
    F8,
    F9,
    F10,
    F11,
    F12,


    Minus,
    Equal,
    Space,
    Tab,
    CapsLock,
    LShift,
    RShift,
    LControl,
    RControl,
    LAlt,
    RAlt,
    LSystem,
    RSystem,
    Menu,
    LBracket,
    RBracket,
    Semicolon,
    Comma,
    Period,
    Apostrophe,     // '''
    Slash,          // '/'
    BackSlash,  //  '\'
    Tilde,      // '`'

    NumPadMultiply,
    NumPadDivide,
    NumPadAdd,
    NumPadSubtract,
    NumPadEnter,
    NumPad0,
    NumPad1,
    NumPad2,
    NumPad3,
    NumPad4,
    NumPad5,
    NumPad6,
    NumPad7,
    NumPad8,
    NumPad9,
    NumPadDecimal,   // '.'
    NumPadSlash,     // '/'
    NumLock,



    PageUp,
    PageDown,
    Home,
    End,
    Insert,
    Delete,
    PrintScreen,
    ScrollLock,
    Pause,

    //TODO test more key here


    //max value of EKey
    MaxKey
};

RSTRUCT()
struct WHENGINE_API SShortcutKey
{
    ROBJECT

    //the main key, such as A,B,C,1,2,3,
    //do not include the modifier key
    EKey Key=EKey::UnSupportedKey;

    bool bAnyAltDown=false;
    bool bAnyCtrlDown=false;
    bool bAnyShiftDown=false;
    bool bAnySystemDown=false;

    bool operator==(const SShortcutKey& Other) const
    {
        return Key==Other.Key &&
            bAnyAltDown==Other.bAnyAltDown &&
            bAnyCtrlDown==Other.bAnyCtrlDown &&
            bAnyShiftDown==Other.bAnyShiftDown &&
            bAnySystemDown==Other.bAnySystemDown;
    }

    uint64_t GetHashCode() const
    {
        return (uint64_t)Key |
            (bAnyAltDown?1:0)<<8 |
            (bAnyCtrlDown?1:0)<<9 |
            (bAnyShiftDown?1:0)<<10 |
            (bAnySystemDown?1:0)<<11;
    }

};
